<!DOCTYPE html>
<html lang="zh">
<head>
	<title>首页统计</title>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<link rel="stylesheet" type="text/css" href="/admin/css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="/admin/css/desk.css" />
	<link rel="stylesheet" type="text/css" href="/admin/css/font-awesome.css" />
	<link rel="stylesheet" href="/admin/layui/css/layui.css">

	<script src="/admin/js/jquery-3.3.1.min.js"></script>
	<script src="/admin/js/bootstrap.js"></script>
	<script src="/admin/layui/layui.js" charset="utf-8"></script>
	<script src="/admin/js/api.js" charset="utf-8"></script>
	<script src="/admin/js/echarts.common.min.js" charset="utf-8"></script>
	<script src="/admin/js/base.js" charset="utf-8"></script>
	<script src="/admin/js/common.js"></script>

	<style type="text/css">
		.wrapper-content{ padding: 50px; min-height: calc(100vh - 10px);}
		.indextop{ padding-bottom: 30px;}
		h3{ font-size: 18px; color: #333; padding: 10px 0;}
		h3 span{ font-size: 15px;font-weight: bold;font-style:oblique}
		.over_hidden{
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
		}

		.checkCountItem{
			cursor:pointer;
		}
		.deskbox .col-sm-12{ width: 100%; padding-top: 20px;}
		.col-sm-4{
			color: #ffffff;
			padding-right: 15px;
			margin-bottom: 15px;}
		.col-sm-4 .checkCountItem{
			box-shadow: 0 0 10px #EEEEEE;
			-webkit-border-radius: 7px;
			padding: 20px;
			width: 70%;
			height: 125px;
			border-radius:7px ;
			background: url("/admin/images/deskbg.jpg") no-repeat;
			background-size: cover;
			overflow: hidden;
		}
		.col-sm-4 div{ padding-bottom: 10px;}
		.col-sm-4 .lg{ font-size: 30px; }
		.fl{ float: left;}
		.p010{ padding: 0 10px;}
		.pt5{ padding-top: 5px;}
		.progress{ max-width: 800px; background: none; margin-bottom: 0px;   margin-right: 20px }
		.layui-bg-blue{ height: 12px; background: linear-gradient(to right, #4492ee, #3ab2ff); max-width: 800px;}

	</style>

</head>

<body class=" " style="background: #EEEEEE; padding-top: 10px; padding-left: 10px;">

	<div class="wrapper wrapper-content" style="background: #ffffff; " >
		<div class="  clearfix" style="position: relative;">
			<div class="indextop ">
				<p><h3>今天</h3></p>
				<p><span class="dayWeek"></span>,欢迎<span class="loginUserName"></span>来到云南省二级建造师执业资格考试网上报名平台。</p>
			</div>
			<div class="clearfix deskbox" >
				<div id = "sum_info">

				</div>
				<div class="col-sm-12 ">
					<div class="clearfix " >
						<div class="col-sm-4">
							<div class="checkCountItem" >
								<div>总报名人数</div>
								<div><span class="lg" id="allSum">0</span>人</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="checkCountItem">
								<div>合格人数</div>
								<div><span class="lg" id="hgSum">0</span>人</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div class="checkCountItem" >
								<div>不合格人数</div>
								<div><span class="lg" id="bhgSum">0</span>人</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div  class="checkCountItem" >
								<div>新考总人数</div>
								<div><span class="lg" id="xkAllSum">0</span>人</div>
								<div >
									<div class="fl">合格：<span id="xkHgSum">0</span></div>
									<div class="fl text-center p010">|</div>
									<div class="fl">不合格：<span id="xkBhgSum">0</span></div>
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div  class="checkCountItem" >
								<div>续考人数</div>
								<div><span class="lg" id="ckAllSum">0</span>人</div>
								<div >
									<div class="fl">合格：<span id="ckHgSum">0</span></div>
									<div class="fl text-center p010">|</div>
									<div class="fl">不合格：<span id="ckBhgSum">0</span></div>
								</div>
							</div>
						</div>
						<div class="col-sm-4">
							<div  class="checkCountItem" >
								<div>存疑待处理人数</div>
								<div><span class="lg" id="cydclSum">0</span>人</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="clearfix"  style="">
				<div class="col-sm-12">
					<div class="flot-chart">
						<div class="flot-chart-content" id="flot-dashboard-chart" style="padding: 0px;padding-top: 20px; position: relative;">
							<div id="main" style="width: 90%;height:100%;"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

<script type="text/javascript">
	var roleType = "";
	var nowYear = getCurrentYear();

	// 图表配置
	var myChart = echarts.init(document.getElementById('main'));

	// 指定图表的配置项和数据
	var option = {
		tooltip : {
			trigger: 'axis'
		},
		legend: {
			data:['合格人员分布']
		},
		calculable : true,
		xAxis : [
			{
				type : 'category',
				data : []
			}
		],
		yAxis : [
			{
				type : 'value'
			}
		],
		series : [
			{
				name:'合格人员分布',
				type:'bar',
				data: [],
				markPoint : {
					data : [
						{type : 'max', name: '最大值'},
						{type : 'min', name: '最小值'}
					]
				}
			}
		]
	};

	function getSignUpStatisticsListByYearTwo (){
		This.jqueryAjax(Api.sce.signUp.getSignUpStatisticsListByYearTwo, {years:nowYear}, "json", function(data) {
			if (data && data.status == 1 && data.object.length == 1) {
				$.each(data.object[0], function (key, val){
					if($('#'+key).length > 0 ){
						$('#'+key).html(val);
					}
				})
			}
		},true);
	}

	function getSignUpStatisticsListByPlaceTwo (){
		This.jqueryAjax(Api.sce.signUp.getSignUpStatisticsListByPlaceTwo, {years:nowYear}, "json", function(data) {
			if (data && data.status == 1) {
				$(data.object).each(function (i, ele){
					option.xAxis[0].data.push(ele.areaName);
					option.series[0].data.push(ele.allSum);
				});
				myChart.setOption(option);
			}
		},true);
	}

	layuiReady(function () {
		$('#sum_info').html('<h3>'+nowYear+'报名信息统计'+'（<span class="">系统自动审核量：<font color="red" id="xtAllSum">0</font>人；初审合格量：<font color="red" id="cshgSum">0</font>人；初审不合格量：<font color="red" id="csbhgSum">0</font>人</span>）</h3>');

		$(".dayWeek").html(MyDate.day() + MyDate.week());

		getSignUpStatisticsListByYearTwo();

		getSignUpStatisticsListByPlaceTwo();

		This.jqueryAjax(Api.base.user.getCurrentBaseUser, {}, "json", function(data) {
			if (data && data.status == 1) {
				$(".loginUserName").html(data.object.name);
				roleType = parseInt(data.object.classCode);
			}
		});

		if ("0" == roleType){	// 监管
			$("#checkCount").show();
			$("#entCount").remove();
			$("#perCount").remove();
		} else if("1" == roleType || "4" == roleType){	// 企业
			$("#entCount").show();
			$("#checkCount").remove();
			$("#perCount").remove();
		} else if ("2" == roleType || "5" == roleType){	// 人员
			$("#perCount").show();
			$("#checkCount").remove();
			$("#entCount").remove();
		}

		//初始化网站地址
		// This.jqueryAjax(Api.common.webBaseUrl, {}, "json", function(data) {
		// 	if (data.status == 1) {
		// 		top.WEB_URL = data.object;
		// 	}
		// }, false);

		//初始化网站地址
		// This.jqueryAjax(Api.common.webBaseUrl, {}, "json", function(data) {
		// 	if (data.status == 1) {
		// 		$(".noticeMore").attr("href", top.WEB_URL + "/webHtml/news/index.html?n=news&type=tzgg");
		// 		//通知公告
		// 		initWebNotice('2e9830af-f08e-45f8-936f-85870269e35d', 5);
		// 	}
		// });

		setTimeout(function () {
			// initOperationLog();
			// initTask();
		}, 200);

	}, '0');

	function initWebNotice(newsClassId, size) {
		$(".articleList").empty();
		This.jqueryAjax(top.WEB_URL + Api.api.web.article.articleList, {classId: newsClassId, pageSize: size} ,"json",function (data) {
			var html = "";
			if (data && data.list && data.list.length > 0) {
				for (var i = 0; i < data.list.length; i++) {
					var item = data.list[i];
					html += '<li>';
					html += '<a href="' + top.WEB_URL + '/webHtml/news/view.html?n=news&id=' + item.id + '" title="' + item.title + '" target="_blank">';
					html += '<div>' + item.title + '</div>';
					// html += '<span class="time">' + dateFormat(item.createDate) + '</span>';
					html += '</a>';
					html += '</li>';
				}
				$(".articleList").append(html);
			}
		})
	}

	function initOperationLog () {
		$(".operationLog").empty();
		This.jqueryAjax(Api.base.baseOperationLog.getBaseOperationLogList, {pageSize: 10} ,"json",function (data) {
			var html = '';
			html += '<tr>';
			// html += '<td><div>操作人</td>';
			html += '<td><div >消息</td>';
			html += '<td><div>操作时间</td>';
			html += '</tr>';
			if (data && data.list) {
				var dataObj = data.list;
				for (var i = 0; i < dataObj.length; i++) {
					var item = dataObj[i];
					html += '<tr>';
					// html += '<td class="over_hidden"><div>' + item.createUserName + '</div></td>';
					html += '<td title="' + item.opMessage + '"><div class="over_hidden">' + item.opMessage + '</div></td>';
					html += '<td><div>' + dateFormat(item.createDate, 'yyyy-MM-dd hh:mm:ss') + '</div></td>';
					html += '</tr>';
				}
				$(".operationLog").append(html);
			}
		})
	}

	function initTask (type) {
		$(".taskContent").empty();
		//初始化待办事项
		This.jqueryAjax(Api.common.deskTask, {roleType: roleType}, "json", function(data) {
			if (data && data.status == 1) {
				var html = "";
				var task = data.object.task;
				$(".perCount").html(data.object.perCount);
				$(".entCount").html(data.object.entCount);
				$(".quaCount").html(data.object.quaCount);
				$(".proCount").html(data.object.proCount);
				$(".caiBlackCount").html(data.object.caiBlackCount);
				$(".certCount").html(data.object.certCount);

				if (task) {
					for (var key in task) {
						var list = task[key];
						var flag = false;
						for (var i = 0; i < list.length; i++) {
							if (Number(list[i].count) > 0) {
								flag = true;
							}
						}
						if (flag) {
							html += "<ul>";
							html += "<h3>" + key + "</h3>";
							for (var i = 0; i < list.length; i++) {
								if (Number(list[i].count) > 0) {
									html += "<li class='col-sm-4' id='" + list[i].moduleIds + "'><a href='javascript:;'>" + list[i].name + "<span>" + list[i].count + "</span>件</a></li>"
								}
							}
							html += "</ul>";
						}
					}
					$(".taskContent").html(html);
				}
			}
			_loadingClose();
			if (type == 1) {
				layerMessage("刷新成功");
			}
		}, true);
	}

	$(function() {
		$(".refreshTask").click(function () {
			_loading();
			setTimeout(function () {
				initTask(1);
			}, 50);
		});
		$(".taskContent").on("click", "ul li", function() {
			var module = $(this).attr("id");
			if (module) {
				_loading();
				setTimeout(function () {
					_loadingClose();
				}, 1000);
				top.topMoudleClick(module.split(","));
			}
		})

		$(".checkCountItem").on("click", function() {
			var module = $(this).attr("id");
			if (module) {
				_loading();
				setTimeout(function () {
					_loadingClose();
				}, 1000);
				top.topMoudleClick(module.split(","));
			}
		});
	});

	function moreOperationLog () {
		locationUrl(Url.creatUrl(Api.base.baseOperationLog.listHtml))
	}

</script>

</body>

</html>